var app = getApp(), api = app.api, is_loading_more = !1, is_no_more = !1;

Page({

    /**
     * 页面的初始数据
     */
    data: {
        mch_id: 0,
        list: [],
        page: 1,
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (t) {
        getApp().page.onLoad(this, t), t.mch_id && (this.data.mch_id = t.mch_id);
        var a = this, e = "shop_data_mch_id_" + t.mch_id, s = getApp().core.getStorageSync(e);
        s && a.setData({
            shop: s.shop
          }), getApp().request({
            url: getApp().api.mch.shop_info,
            data: {
              mch_id: t.mch_id,
            },
            success: function(e) {
              0 == e.code && a.setData({
                shop: e.data.shop,
              })
            }
          }), this.loadMoreList();
    },
    loadMoreList() {
        var t = this;
        if (!is_loading_more) {
            t.setData({
                show_loading_bar: !0
            }), is_loading_more = !0;
            var i = t.data.page;
            getApp().request({
                url: getApp().api.mch.photo.list,
                data: {
                    page: i,
                    mch_id: t.data.mch_id,
                },
                success: function(o) {
                    0 == o.data.list.length && (is_no_more = !0, t.setData({
                        no_more: !0
                    }));
                    var a = t.data.list.concat(o.data.list);
                    t.setData({
                        list: a,
                        page: i + 1
                    });
                },
                complete: function() {
                    is_loading_more = !1, t.setData({
                        show_loading_bar: !1
                    });
                }
            })
        }
    },
    
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {
        getApp().page.onReachBottom(this), is_no_more || this.loadMoreList();
    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})